<?php echo isset($warning) ? '<div class="alert bg-danger">'.$warning.'</div>' : "" ?>
<form class="form-horizontal" role="form" method="post" action="<?=site_url('affiliate/index') ?>">  
  <div class="form-group">
    <label for="inputPassword3" class="col-sm-2 control-label">Chọn ngày</label>    
    <div class="container">
      <div class="col-sm-6" style="height:75px;">
         <div class='col-md-5' style="margin-right:10px;">
              <div class="form-group">
                  <div class='input-group date' id='datetimepicker8'>
                      <input type='text' name="fromDate" class="form-control" placeholder="Chọn từ ngày" value="<?=isset($fromDate) ? $fromDate : "" ?>" />
                      <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
                      </span>
                  </div>
              </div>
          </div>              
          <div class='col-md-5' style="">
              <div class="form-group">
                  <div class='input-group date' id='datetimepicker9'>
                      <input type='text' name="toDate" class="form-control" placeholder="tới ngày" value="<?=isset($toDate) ? $toDate : "" ?>"/>
                      <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
                      </span>
                  </div>
              </div>
          </div>
      </div>    
      <script type="text/javascript">
          $(function () {
              $('#datetimepicker8').datetimepicker();
              $('#datetimepicker9').datetimepicker();
              $("#datetimepicker8").on("dp.change",function (e) {
                 $('#datetimepicker9').data("DateTimePicker").setMinDate(e.date);
              });
              $("#datetimepicker9").on("dp.change",function (e) {
                 $('#datetimepicker8').data("DateTimePicker").setMaxDate(e.date);
              });
          });
      </script>
      <button type="submit" class="btn btn-primary">Tìm kiếm</button></td>    
    </div>        
  </div>  
</form>

<?php if(!empty($showData)): ?>
<div class="table-responsive">
	<table class="table table-bordered">
		<thead>		
			<tr align="center" class="success">
			<td class="info">Ngày</td>
			<?php foreach ($showData as $key => $value): ?>				
				<td><?=$key; ?></td>
			<?php endforeach; ?>
			<td class="info">Tổng cộng</td>
			</tr>
		</thead>
		<tbody>
			<tr align="center" >
			<td class="info">Số lượng</td>
			<?php foreach ($showData as $key => $value): ?>				
				<td><?=$value['qty']; ?></td>
			<?php endforeach; ?>
			<td class="info"><?=$total_qty; ?></td>
			</tr>
			<tr align="center" >
			<td class="info">Doanh thu</td>
			<?php foreach ($showData as $key => $value): ?>				
				<td><?=$value['revenue']; ?></td>
			<?php endforeach; ?>
			<td class="info"><?=$total_revenue; ?></td>
			</tr>
		</tbody>
	</table>
</div>			
<?php endif; ?>

<!-- hiển thị tổng xuất kho, lưu kho -->
<!-- <div class="page-header">
  <h1>Thống kê</h1>
</div>
<div class="row">
  <div class="col-sm-4">
    <ul class="list-group">
      <a href="#" class="list-group-item active">
        <span class="glyphicon glyphicon-qrcode"></span> Thông tin
      </a>
      <li class="list-group-item"><span class="glyphicon glyphicon-import"></span> Sản phẩm: </li>
      <li class="list-group-item"><span class="glyphicon glyphicon-export"></span> Doanh thu: </li>      
      <li class="list-group-item"><span class="glyphicon glyphicon-calendar"></span> Ngày lập thống kê: <?=date('d/m/Y',strtotime('now')) ?></li>      
    </ul>
  </div><!-- /.col-sm-4 -->    
<!-- </div> -->
<!-- hiện thị thành công -->